package dev.alm.springaidemo.controller;

import dev.alm.springaidemo.tool.DateTimeTool;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("tc")
public class ToolCallingController {

    @Resource
    private ChatClient chatClient;

    @RequestMapping("chat")
    public String chat(@RequestParam("message") String message) {
        return chatClient.prompt().user(message).tools(new DateTimeTool()).call().content();
    }


}
